/*
 * DocReaderStream.h
 *
 *  Created on: 2010-11-22
 *      Author: LiuShiWei
 */

#ifndef DOCREADERSTREAM_H_
#define DOCREADERSTREAM_H_

#include <shared_ptr.h>
#include <ZLInputStream.h>
#include <ZLFile.h>
class DocReaderStream : public ZLInputStream {

public:
	DocReaderStream(shared_ptr<ZLInputStream> base, size_t maxSize);
	DocReaderStream(const ZLFile &file);
	~DocReaderStream();

private:
	bool open();
	size_t read(char *buffer, size_t maxSize);
	void close();

	void seek(int offset, bool absoluteOffset);
	size_t offset() const;
	size_t sizeOfOpened();

private:
	shared_ptr<ZLInputStream> myBase;
	char *myBuffer;
	size_t mySize;
	size_t myOffset;
	std::string path;
};


#endif /* DOCREADERSTREAM_H_ */
